table.RECNO Function

Syntax

Recno as N = Recno()

Description

Return the current record for the table.

Discussion

The <TBL>.RECNO() method returns the record number of the current record in the table referenced by <TBL>. This is useful if you want to store a "bookmark" for the current record. Once you know a record's record number you can return to that record very quickly by setting the primary index to record number and then using the <TBL>.FETCH_FIND() method.

Example

This script captures the current record number and then after some processing, returns to that record.

tbl = table.current()
index = tbl.index_primary_put("Lastname")
tbl.fetch_find("Smith")
record = tbl.recno()
'... some processing which moves to another record
'Return to the bookmarked record
tbl.index_primary_put()'set index to record number
tbl.fetch_find(record) 'return to record

This script returns the current record number, given only the form name.

dim frm as P
dim tbl as P
frm = obj("Customer Information")
tbl = frm.table_get()
? tbl.recno()
= 9.000000

Note: This method returns a large, meaningless number if there are no records in the table. The TBL.Records_Get Method can be used to determine that there are actually no records in the table.

See Also